<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <App></App>
  </div>
  <script>



    // 假设Header组件是一个公告组件 我们可以直接全局注册Header组件，那么就可以在任意组件中直接使用
    const Header = {
      name: "Header",
      template: "<h1>Header组件</h1>"
    };


    const App = {
      name: "App",
      template: "<div>App组件<Header></Header></div>",
      data() {
        return {

        };
      },
    };

    // 使用Vue.component('组件名称',组件)对某个组件进行全局注册
    Vue.component("Header", Header);

    new Vue({
      el: "#app",
      components: {
        App
      },
      data() {
        return {};
      }
    })
  </script>
</body>

</html>